/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nueva.esperanza.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mgcharuc
 */
@Entity
@Table(name = "RANGOEMISIONCHEQUE",schema = "SYSTEM")
@SequenceGenerator(name="seqRango", sequenceName="SYSTEM.RANGO_SEQ" )
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Rangoemisioncheque.findAll", query = "SELECT r FROM Rangoemisioncheque r"),
    @NamedQuery(name = "Rangoemisioncheque.findByIdusuario", query = "SELECT r FROM Rangoemisioncheque r WHERE r.idusuario = :idusuario"),
    @NamedQuery(name = "Rangoemisioncheque.findByIdrango", query = "SELECT r FROM Rangoemisioncheque r WHERE r.idrango = :idrango"),
    @NamedQuery(name = "Rangoemisioncheque.findByMontominimo", query = "SELECT r FROM Rangoemisioncheque r WHERE r.montominimo = :montominimo"),
    @NamedQuery(name = "Rangoemisioncheque.findByMontomaximo", query = "SELECT r FROM Rangoemisioncheque r WHERE r.montomaximo = :montomaximo")})
public class Rangoemisioncheque implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @GeneratedValue(generator = "seqRango")
    @Column(name = "IDUSUARIO")
    private BigDecimal idusuario;
    @Basic(optional = false)
    @Column(name = "IDRANGO")
    private BigInteger idrango;
    @Basic(optional = false)
    @Column(name = "MONTOMINIMO")
    private BigInteger montominimo;
    @Basic(optional = false)
    @Column(name = "MONTOMAXIMO")
    private BigInteger montomaximo;
    @JoinColumn(name = "IDUSUARIO", referencedColumnName = "IDUSUARIO", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private Usuario usuario;

    public Rangoemisioncheque() {
    }

    public Rangoemisioncheque(BigDecimal idusuario) {
        this.idusuario = idusuario;
    }

    public Rangoemisioncheque(BigDecimal idusuario, BigInteger idrango, BigInteger montominimo, BigInteger montomaximo) {
        this.idusuario = idusuario;
        this.idrango = idrango;
        this.montominimo = montominimo;
        this.montomaximo = montomaximo;
    }

    public BigDecimal getIdusuario() {
        return idusuario;
    }

    public void setIdusuario(BigDecimal idusuario) {
        this.idusuario = idusuario;
    }

    public BigInteger getIdrango() {
        return idrango;
    }

    public void setIdrango(BigInteger idrango) {
        this.idrango = idrango;
    }

    public BigInteger getMontominimo() {
        return montominimo;
    }

    public void setMontominimo(BigInteger montominimo) {
        this.montominimo = montominimo;
    }

    public BigInteger getMontomaximo() {
        return montomaximo;
    }

    public void setMontomaximo(BigInteger montomaximo) {
        this.montomaximo = montomaximo;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idusuario != null ? idusuario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rangoemisioncheque)) {
            return false;
        }
        Rangoemisioncheque other = (Rangoemisioncheque) object;
        if ((this.idusuario == null && other.idusuario != null) || (this.idusuario != null && !this.idusuario.equals(other.idusuario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "nueva.esperanza.modelo.Rangoemisioncheque[ idusuario=" + idusuario + " ]";
    }
    
}
